Part Number Hot Search : 
NJW4820F MHW9188A SB104 SA8016WC 1004A MAN6980E WF050A MJE13003
Product Description
Full Text Search
 

To Download AN1115 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 (R)
AN1115 APPLICATION NOTE
ST52x301 FOR STEPPER MOTORS FUZZY CONTROL
Authors: G. Grasso, M. Lo Presti
1. INTRODUCTION
This application note is intended to explain how to control a stepper motor by using ST52x301 Fuzzy Microntroller. Stepper Motors are well known in position controls field applications and are particularly used in Robotics, Computer peripherals, Industrial servo quality drivers and so on. One of the main advantages of stepper motors is the strong relation between electrical pulses and rotation discrete angle steps. This allows to exactly know the shaft position of the motor without using a position sensor. Depending on the building characteristics of the motor and its driving techniques, it is possible to have a wide range of stepper motors. Generally speaking, permanent magnetic cores are referred to as Stepper Motor while soft iron cores are referred to as Variable Reluctance Motors.
2. FUNCTIONAL DESCRIPTION
The Stepper Motor's operating principle used in the current implementation, is described in fig. 1. A 12pole stator is energized by means of a 3-phase winding. Each coil is assembled in order to generate, in the space, the same number of magnetic poles. The rotor consists in a permanent magnetic core shaded in order to produce 8 magnetic poles. The poles produced by the stator current force the rotor to move in order to be aligned to the rotor magnetic field. This implies an alignment of the rotor core's nearest pole to the stator energized poles. When the phase 1 is energized, the rotor pole P1 is aligned to the field. Then, if the phase 1 is deenergized and 2 is energized, a new set of magnetic poles will be created in the stator. This new magnetic field will force the rotor to move in counterclockwise direction to align its poles to the field. This action yields a shaft rotation of a step angle q. Generally, for a q-phase motor with Nr rotor teeth, the following equation is given:
Step_angle =
Then, in our application: 15=
360 qNr
360 3x8
The spin direction can be controlled by a phase excitation sequence. Excitation sequence 1, 3 and 2 will move the rotor clockwise. From energy considerations, it can be shown that:
T=f(i,
dL ) d
This general relation is true for any kind of stepper motor. For instance, the strong relation between T and dL/d allows the Variable Reluctance motor to move.
January 1999
1/16
AN1115 - APPLICATION NOTE
Figure
1
3. DRIVING TOPOLOGY
A variety of configurations is possible to energize the winding phase in a better way, nevertheless, the simplest driving topology will be investigated here. Due to the internal connections of our motor, a unipolar driver is used. Fig.2 shows the basic topology used to energize the three phases of the motor.
Figure
2
2/16
(R)
ST52x301 FOR STEPPER MOTORS FUZZY CONTROL
Motor specifications impose a maximum voltage of 24V for each phase and a phase current of 0.5A then, there are no problems to use Darlington BJT as switches. When the phase Ph1 is energized (Q1 on), the voltage Vcc is applied to the phase coil; then the current raises with a rise-time related to the inductance value L and to the back-EMF of the coil. Roughly, the maximum value for the current is limited by a winding resistance unless the controller avoids the current to go above a fixed level. To perform this current limitation it is possible to "sense" the current level in the phase and reduce the applied voltage to the phase coil. A Pulse Width Modulation is the simplest way to control the mean value of the applied voltage. Fig. 3 shows the basic principle of modulation. Figure 3
During the powering-time of each phase, ST52x301 can modulate Ton and Toff of the PWM signal in order to increase or decrease the mean applied voltage. As we will see later, the AND gates can be replaced by a software "AND" inside the main program of ST52x301.
4. CURRENT CONTROL BY USING ST52X301 TRIAC-PERIPHERAL
ST52x301 provides up to 4 Analog inputs in the range between 0 and 2,5V with a conversion time of 33s each. Converted values are stored in 8-bit internal registers until the following conversion. Due to the input range, ADC resolution is 10 mV. Choosing the appropriate value for Rsense it is possible to read all the working current of each phase winding. Moreover, ST52x301 provides a Triac-Driver peripheral to manage directly a Triac in several working modes. For example, In PWM mode, the user only needs to fix the PWM frequency and the duty-cycle of the wave. For instance, we can fix a constant PWM frequency according to the maximum switching frequency of the Darlington in order to maximize switches efficiency. After that, we can control the duty-cycle of the PWM wave to achieve the desidered voltage on the phase coil.
(R)
3/16
AN1115 - APPLICATION NOTE
Fig. 4 - 5 display the settings for the AD Converter and the Triac peripheral in the FUZZYSTUDIOTM 3.0 environment. Figure 4
4/16
(R)
ST52x301 FOR STEPPER MOTORS FUZZY CONTROL
Figure
5
(R)
5/16
AN1115 - APPLICATION NOTE
5. SPEED SEQUENCE BY USING ST52X301 TIMER-PERIPHERAL
The speed of the motor shaft can be varied by controlling the excitation time of the phases. To do this, it is possible to use TIMER-peripheral of ST52x301. Timer settings are shown in fig. 6. The 16-bit Prescaler of the Timer is configured to give an internal clock pulse of 1ms. Then, the Timer period can vary between 1ms and 1ms x 256 according to the Timer Counter value. Figure 6
To switch among the three phases, we can use the Timer Interrupts provided by the peripheral each time the Timer has completed a count.
6/16
(R)
ST52x301 FOR STEPPER MOTORS FUZZY CONTROL
6. FUZZY CONTROL
The goal of our Fuzzy Control is to maintain the desidered Torque regardless to the applied load to the shaft. As observed in the equation (3), Torque is related to the windings current, then we can use current information on Rsense to manage the provided Torque. Figure 7
To carry out this control ST52x301 reads Torque "Ref" value from AD Channel0 and the instantaneous Torque supplied to the motor by means of Rsense and AD Channel 2. A software task perfoms the "error" calculation error=VREF-Vtorque "error" variable forms also the Fuzzy input for the Fuzzy controller block. We chose to cover the "error" Universe of Discourse by means of three Membership Functions. The Fuzzy algorithm uses three rules to compute the fuzzy out achieving an incremental variable for PWM duty-cycle. This incremental value, added to actual duty-cycle value, will be sent to Triac counter to change the Ton and Toff of the wave.
(R)
7/16
AN1115 - APPLICATION NOTE
Figure
8
By observing the rules, it is possible to understand the PID strategy. If error is negative (i.e. Torque << sense), shaft is forcing with more torque than requested. This implies a useless current into the windings. The action to perform, is to reduce the applied voltage to the winding; then Ton on PWM wave must decreased. The first rule produces a negative Fuzzyout in case "error is neg". This negative Fuzzyout value will be added to the duty-cycle variable before sending it to the Triac Counter (duty-cycle=duty-cycle + Fuzzyout). The opposite action is performed by the third rule. The second rule will be activated when torque sense and will produce no variation on PWM duty-cycle.
8/16
(R)
ST52x301 FOR STEPPER MOTORS FUZZY CONTROL
7. HARDWARE DESCRIPTION
The figure below shows the complete schematic used to implement the real system. ST52x301 and an integrated Darlington array are enough to drive the stepper motor. An internal software task is used instead of three external AND's to feed the PWM wave to the BJT. A 20MHz oscillator provides the system clock whereas 4 capacitors provide a filtering of the power supply just near ST52x301 power supply pin's. Linear integrate ULN2075 is a four Darlington array able to provide up to 1.5A for each transistor. This interface logic chip is designed to accepts TTL input levels. Figure 9
(R)
9/16
AN1115 - APPLICATION NOTE
8. SOFTWARE DESCRIPTION
Let us describe the software tasks by means of pictures. First of all we need to inizialize the ST52x301 peripherals and to define the variables. The figures below show the Parallel Port (OUT mode) and A/D Converter settings (2 input channels). Figure 10
With this configurations, ST52x301 will convert sequentially 3 analog inputs in about 66 s and will give 8 output lines with 5 A maximum current.
Figure
11
Fig. 11 shows the main program. After an initialization block for the variables, Triac and Timer counter values are setted. A Mask block named "Triac_Tim_on" enables these peripherals to generate Interrupts.
10/16
(R)
ST52x301 FOR STEPPER MOTORS FUZZY CONTROL
Three "start" blocks allow ADC, Timer and Triac peripheral to work. After that, a software loop form the main routine. In this loop, ST52x301 waits for an interrupt (Timer or Triac INT) and an INT coming from the program counter goes ahead to the "Speed" and "Torque" blocks. Figure 12
In these blocks Timer and Triac counter will be refreshed with the new value. The main point of the software program is the INT subroutines. The following figure shows the phase generation by means of interrupt routines. In the Timer Interrupt sub-routine, the first block switches phases among three different variables' values. The variable "phase" changes among "1", "2", "4". These values will be sent to the parallel port. With Timer Prescaler settings, a switch occurs about one hundrend milliseconds. The Parallel port will produce three sequential square waves on P0, P1, P2 pins. In the Triac Interrupt sub-routine, a flag switches on each coming INT, between set and reset of PWM out. The Triac Interrupts routine is executed about every 150 s.
RESULTS AND CONCLUSION
By using ST52x301 Fuzzy Controller it is easy to implement motor driving by using few components. Presented stepper motor control is good compromise between system costs and motor performances. The graphical programming environment reduces the development time also for not expert programmers. This application note was intended to show how easy is the use of ST52x301 as Controller in the servodrives. A lot of improvement could be done in the presented control by changing the software and fuzzy algorithm.
(R)
11/16
AN1115 - APPLICATION NOTE
APPENDIX
; ; ; ; Source file: Compile time: Device type: Compiler version: data data data stop irq irq irq irq irq 0 0 20 147 0 0 1 15 127 15 0 2 0 107 20 Timer_Interrupt Triac_Interrupt AD_Interrupt SCI_Interrupt External_Interrupt P:\APPLIC\GRASSOG\SRM\STEPPWM.wcl Fri Sep 25 15:54:31 1998 ST52x301 01.00 (02.06.98)
3 4 1 2 0 stop @@WCLStart@@: ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf Start: init: ldrc ldrc init_triac: mdgi ldrc ldpr megi
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
255 4 10 0 31 78 40 14 22 0 4 192 64 0 0 228
13 14
0 0
0 1
128 0
12/16
(R)
ST52x301 FOR STEPPER MOTORS FUZZY CONTROL
init_tim: mdgi ldrc ldpr megi Triac_Tim_on: ldcf AD_start: ldcf start_tim: ldcf ldcf triac_strt: ldcf ldcf Wait0: waiti speed: ldpr rd_sense: ldri err_calc: mdgi ldrr subo megi FUZZY: ldrr stop ldp ldp fzand con ldp ldp fzand con ldp ldp fzand con out stop 0 0 200 0
14 2 6 6 11 10
24 11 41 43 194 7
0 10
12 2
8 8
11 10
0 0 0 117 0 0 127 0 0 137 0
8 2 2
1 1
0 0
(R)
13/16
AN1115 - APPLICATION NOTE
ldri summ: mdgi ldrc add add megi reload: ldpr jp External_Interrupt: fine_corsa: IRET4: reti AD_Interrupt: IRET1: reti SCI_Interrupt: IRET3: reti Timer_Interrupt: switch_phase: mdgi ldrc add megi mdgi ldrc sub megi jpnz @@00001: ldrc @@00000: @@00002: mdgi ldrc sub megi jpz jpns @@00004: ldrc
7
9
0 9 9
128 7 0
1 Wait0
9
0 13
1 0
0 0
3 13
@@00000 13 4
0 0
5 13
@@00004 @@00003 13 1
14/16
(R)
ST52x301 FOR STEPPER MOTORS FUZZY CONTROL
@@00003: @@00005: speed_REF: ldri torque_REF: ldri IRET0: reti Triac_Interrupt: flag_even: mdgi ldrc and megi jpnz jp @@00007: jp jp @@00006: jp @@00008: Send_phase: ldpr inc_flag: mdgi ldrc add megi IRET2: reti reset: mdgi ldrc ldpr megi jp stop
12 11
0 1
0 0
1 15
@@00007 @@00006 reset @@00008 Send_phase
2
13
0 15
1 0
0 2 inc_flag
0 0
(R)
15/16
AN1115 - APPLICATION NOTE
REFERENCES
[1] [2] [3] STMicroelectronics - "Designer's Guide to Power Products" - Application manual Mohan, Undeland, Robbins "Power Electronics: Converters, Applications and Design" John WILEY & Sons STMicroelectronics - FUZZYSTUDIOTM 3.0 - User Manual
Information furnished is believed to be accurate and reliable. However, STMicroelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of STMicroelectronics. Specification mentioned in this publication are subject to change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are not authorized for use as critical components in life support devices or systems without express written approval of STMicroelectronics. The ST logo is a registered trademark of STMicroelectronics (c) 1999 STMicroelectronics - Printed in Italy - All Rights Reserved STMicroelectronics GROUP OF COMPANIES Australia - Brazil - Canada - China - France - Germany - Italy - Japan - Korea - Malaysia - Malta - Mexico - Morocco - The Netherlands Singapore - Spain - Sweden - Switzerland - Taiwan - Thailand - United Kingdom - U.S.A. http://www.st.com
16/16
(R)


▲Up To Search▲   

 
Price & Availability of AN1115

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X